package cn.iocoder.yudao.module.shop.dal.mysql.shopOpenTime;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.shopOpenTime.ShopOpenTimeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.shopOpenTime.vo.*;

/**
 * 商户营业时间 Mapper
 *
 * @author 吕小文
 */
@Mapper
public interface ShopOpenTimeMapper extends BaseMapperX<ShopOpenTimeDO> {

    default PageResult<ShopOpenTimeDO> selectPage(ShopOpenTimePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopOpenTimeDO>()
                .eqIfPresent(ShopOpenTimeDO::getShopId, reqVO.getShopId())
                .eqIfPresent(ShopOpenTimeDO::getDay, reqVO.getDay())
                .eqIfPresent(ShopOpenTimeDO::getIsCloseDay, reqVO.getIsCloseDay())
                .eqIfPresent(ShopOpenTimeDO::getIsOpenAllDay, reqVO.getIsOpenAllDay())
                .eqIfPresent(ShopOpenTimeDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(ShopOpenTimeDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(ShopOpenTimeDO::getDay)
                .orderByDesc(ShopOpenTimeDO::getId));
    }

}